<template>
    <div id="authoritions">
        <tg-el-table :apiURL="getMaintencesData" :tableColumn="tableColumn" :operators="operators" :searchList="searchList" 
            :searchOpeartors="searchOpeartors" :searchModel="searchModel" :hasIndex="true" :selectable="selectable">
            <!-- 针对自定义列的slot -->
            <!-- <template #status="{row,index}">
                <span v-if="row.status == '待处理'" class="pending status_label">{{row.status}}</span>
                <span v-else-if="row.status == '未处理'" class="untreated status_label">{{row.status}}</span>
                <span v-else-if="row.status == '已处理'" class="processed status_label">{{row.status}}</span>
            </template> -->
            <!-- 表格批量操作的slot --> 
            <template #optSlot>
                <el-button type="primary" size="small">新增<i class="el-icon-plus el-icon--right"></i></el-button>
                <el-button type="primary" size="small">删除<i class="el-icon-delete el-icon--right"></i></el-button>
            </template>
        </tg-el-table>
    </div>
    
</template>

<script>
// import TgElTable from '@/components/hjTable/HJTable.vue'
export default {
    name:'authoritions',
    data(){
        return {
            // apiURL:getMaintencesData,
            tableColumn:[
                {
                    label:'编号',
                    type:'text',
                    prop:'code',
                    width:'300',
                    fixed:'false'
                },
                {
                    label:'设备名称',
                    type:'text',
                    prop:'name',
                    fixed:'false'
                },
                {
                    label:'高程',
                    type:'text',
                    prop:'elevation',
                    fixed:'false'
                },
                {
                    label:'地址',
                    type:'text',
                    prop:'street',
                    fixed:'false'
                },
                {
                    label:'管网',
                    type:'text',
                    prop:'pipeNetwork',
                    fixed:'false'
                },
                {
                    label:'经纬度',
                    type:'text',
                    prop:'longitude',
                    fixed:'false'
                },
                {
                    label:'纬度',
                    type:'text',
                    prop:'latitude',
                    fixed:'false'
                },
                {
                    label:'状态',
                    type:'text',
                    prop:'status'
                },{
                    label:'安装时间',
                    type:'text',
                    prop:'installTime'
                }
            ],
            operators:{
                label:'操作',
                fixed:'right',
                items:[
                    {
                        index:1,
                        name:'查看',
                        callBack:'openNews'
                    },
                    {
                        index:2,
                        name:'删除',
                        callBack:'deleteNews',
                        type:'danger'
                    }
                ]
            },
            searchList:[
                {   index:1,
                    name:'name',
                    label:'设备名称',
                    type:'input'
                },
                {
                    index:2,
                    name:'type',
                    label:'设备类型',
                    type:'select',
                    options:[
                        {
                            index:1,
                            label:'压力表',
                            value:'压力表'
                        },
                        {
                            index:2,
                            label:'流量计',
                            value:'流量计'
                        },
                        {
                            index:3,
                            label:'余氯仪',
                            value:'余氯仪'
                        }
                    ]
                }
            ],
            searchModel:{
                name:'',
                type:''
            },
            searchOpeartors:[
                {
                    text:'查询',
                    name:'search',
                    type:'primary'
                },
                {
                    text:'重置',
                    name:'reSet',
                    type:''
                }
            ],
            // selectable:'multiple',//多选
            selectable:'signal',//单选
            total:0,
            pageSize:10,
            currentPage:1
        }
    },
    components:{
        TgElTable :() => import ('@/components/hjTable/HJTable.vue')
    },
    created(){
        this.getMaintencesData();
    },
    methods:{
        getMaintencesData(){
            return this.$axios.post('http://43.136.137.111:9898/system/pipe/network/list',{})
        },
    }
}
</script>

<style lang="less" scoped>
    #authoritions{
        height: 100%;
    }
</style>